﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Content.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<script language="javascript">
    var appRoot = '<%=Url.Content("~/") %>';
    function resolveUrl(url) {
        return url.replace("~/", appRoot);
          }
</script>

    <%
    try
    {
        Html.RenderPartial(this.ViewData["__EmbeddedViewName"].ToString());
    }
    catch(Exception ex)
    {
        while (ex.InnerException != null)
            ex = ex.InnerException;
        
        var ideExtension = HttpContext.Current.Items["__currentIdeExtension"] as MethodWorx.CMS.Plugins.IdeExtension;
        %>
                <div class="formItem">
                    <em>
                        <img src="<%=Url.Content("~/Images/icons/exclamation.png")%>"/>
                        <strong>Error:</strong> An error occured whilst processing the plugin, please check the plugin status under the administration panel for more details
                    </em>
                </div>
                <% if(ideExtension != null) { %>
                <div class="formItem" style="overflow:hidden">
                    <p>
                        <em>
                        <img src="<%=Url.Content("~/Images/icons/information.png")%>"/>The plugin below has been disabled, and any extensions it has registered have now been unloaded.</em>
                    </p>
                    <label>Plugin Id: </label><%=ideExtension.Plugin.Id%>
                    <br />
                    <label>Plugin Name: </label><%=ideExtension.Plugin.Name%>
                    <br />
                    <label>Ide Extension: </label><%=ideExtension.Name %>
                    <br />
                    <label>Error: </label><%=ex.Message %>
                    <hr />
                    <p>
                    <label>Stack Trace: </label>
                    </p>
                    <p style="clear:both"><%=ex.StackTrace.Replace("\n", "<br/>")%>
                    </p>
                </div>
                <%
                    var safePlugin = ideExtension.Plugin as MethodWorx.CMS.Plugins.SafePlugin;
                    if (safePlugin != null)
                        safePlugin.RegisterException("Rendering View", ex, null, ideExtension);
                        %>
                <%} %>
        <%
    } %>

</asp:Content>
